<?php if (!defined('THINK_PATH')) exit();?><!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<title>修改外勤拜访</title>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<!--[if lt IE 9]>
<script type="text/javascript" src="/Public/Admin/lib/html5.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/respond.min.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/Public/Admin/lib/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/lib/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/css/sty.css">
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->
<style type="text/css">
	.f-w{font-weight: bold;}
    /*.input-text{border: none !important}*/
    /*textarea{width: 95% !important}*/
    td{font-size: 14px !important}
    /*.page-container{margin-bottom: 25px}*/
    /*button{margin-left: 20px }*/
    /*textarea,.Wdate{background-color: #fbfbfb !important}*/
    .textarea{height: 70px;width: 90%}
    .wq5{margin-top: 10px;margin-bottom: 10px;}
    .textarea1{margin-top: 10px;}
    /*.a_c{float: right;padding-right: 100px;padding-top: 20px;color: blue}*/
    .test_box {
        width: 97.5%; 
        min-height: 40px; 
        max-height: 150px;
        overflow-x: hidden;
        overflow-y: auto;
        border: solid 1px #ddd;
    }
    .test_box:hover{border: solid 1px #3bb4f2}
    .input_box{padding-left: 0px;}
    textarea{line-height:1.3 !important; font-size:14px !important; resize : none; padding: 5px;}
</style>
</head>


<body>
<div class="page-container">
    <!--<div class="mt-20 wq5" style="padding-bottom: 12px !important;padding-top: 12px !important">-->
    <form class="form form-horizontal" >
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">营销人：</label>
            <div class="formControls col-xs-8 col-sm-8 ">
                <?php echo ($outArr["add_name"]); ?>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">拜访经办人：</label>
            <div class="formControls col-xs-8 col-sm-8 ">
                <?php echo (get_agent_name($outArr["agent_id"])); ?>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">拜访地点：</label>
            <div class="formControls col-xs-8 col-sm-8 ">
                <?php echo ($outArr["location_in"]); ?>
                <!-- <input type="text" class="input-text" value="<?php echo ($outArr["location_in"]); ?>" placeholder="" id="location_in" name="location_in"> -->
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-3 col-sm-3" >拜访时间：</label>
            <div class="formControls col-xs-8 col-sm-8 ">
                <?php echo (time_for_date($outArr["visit_time"],'Y-m-d H:i')); ?>
                <!-- <input type="text"  onfocus="WdatePicker()" value="<?php echo (time_for_date($outArr["visit_time"],'Y-m-d H:i')); ?>" id="visit_time" name="visit_time" class="input-text Wdate" style="width:180px;"> -->
            </div>
        </div>
        <div class="row cl">
                <label class="form-label col-xs-3 col-sm-3">沟通内容：</label>
                <input type="hidden" name="id" value="<?php echo ($outArr["id"]); ?>" />  <!-- 存放当前拜访id -->  
                <input type="hidden" name="num" id="num" value="<?php echo (count($outArr["content"])); ?>" />  <!-- 存放内容行数量 -->  
                <?php if(is_array($outArr["content"])): $i = 0; $__LIST__ = $outArr["content"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i; if($i == 1): ?><div class="formControls col-xs-8 col-sm-8 col-sm-offset-3 input_box">
                    <?php else: ?>
                        <div class="formControls col-xs-8 col-sm-8 col-xs-offset-3 col-sm-offset-3 textarea1 input_box"><?php endif; ?>
                        <input type="hidden" name="conid<?php echo ($i); ?>" value="<?php echo ($val["id"]); ?>" />
                        <div class="f-l"><?php echo ($i); ?>.</div>
                        <textarea class="test_box content" name="content<?php echo ($i); ?>" rows="3"><?php echo ($val["content"]); ?></textarea>
                        <!--<label><?php echo ($i); ?>. </label><textarea name="content<?php echo ($i); ?>" cols="" rows="" class="textarea"  placeholder="请输入总结内容" datatype="*10-100" dragonfly="true"  onKeyUp="textarealength(this,400)"><?php echo ($val["content"]); ?></textarea>-->
                    </div><?php endforeach; endif; else: echo "" ;endif; ?>
                <div class="formControls col-xs-8 col-sm-8 col-sm-offset-3" style="margin-top:5px;">
                    <a href="#" onclick="add()" class="a_c" style="color:blue">新增一行 +</a>
                </div>
            </div>
        <div class="row cl">
            <label class="form-label  col-xs-3 col-sm-3" >下次拜访时间：</label>
            <div class="formControls col-xs-8 col-sm-8 ">
                <?php echo (time_for_date($outArr["appoint_time"],'Y-m-d H:i')); ?>
                <!-- <input type="text"  onfocus="WdatePicker()" value="<?php echo (time_for_date($outArr["appoint_time"],'Y-m-d H:i')); ?>" id="appoint_time" name="appoint_time" class="input-text Wdate" style="width:180px;"> -->
            </div>
        </div>
        <div class="row cl" style="margin-top:25px;">
            <div class="col-xs-8 col-sm-8 col-xs-offset-3 col-sm-offset-3">
                <button onclick="xg()" id="sub" class="btn btn-primary radius" type="button">&nbsp;&nbsp;修改&nbsp;&nbsp;</button>
                <button onclick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
    <!--</div> -->
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/Public/Admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/My97DatePicker/WdatePicker.js"></script>
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<!-- <script type="text/javascript" src="../lib/webuploader/0.1.5/webuploader.min.js"></script>  -->
<script type="text/javascript">
// 添加新行
function add(){
    var len = $('.input_box').length + 1;
    var content = '<div class="formControls col-xs-8 col-sm-8 col-xs-offset-3 col-sm-offset-3 textarea1 input_box"><div class="f-l">' + len + '.</div><textarea class="test_box content" name="content' + len + '" rows="3"></textarea></div>';
    $('.input_box:last').after(content);
    $('#num').val(len);
}

function xg(){
    // if( $.trim($('#location_in').val()) == '' ){
    //     layer.msg('请填写拜访地点',{icon:2,time:1000});
    // }else if( !$('#visit_time').val() ){
    //     layer.msg('请选择拜访时间',{icon:2,time:1000});
    // }else{
    // }
    var con = 0; // 判断是否填写内容
    for (var i = 0; i < $('.content').length; ++i) {
        if($.trim($('.content').eq(i).val()) !== ''){  // 如果此行内容不为空
            con = 1; break;
        }
    }
    if(con == 1){
        $('#sub').attr('display','');
        $.ajax({  
            url: "<?php echo U('Out/editCheck');?>", 
            type: "POST",  
            data: $('form').serializeArray(), 
            success: function(msg){  
                //console.log(msg);
                if(msg['state'] == 200){
                    layer.msg( msg['content'] ,{icon:1,time:1000});
                    setTimeout('parent.location.href = "<?php echo U('Out/index');?>"', 1000);
                }else{
                    layer.msg( msg['content'] ,{icon:2,time:1000});
                    $('#sub').attr('display','xg()');
                }
            }  
        });
    }else{
        layer.msg('请填写沟通内容',{icon:2,time:1000});
    }
}

</script>


</body>
</html>